import request from '@/utils/request'

// 产品管理
export const getProduct = (params) => {
  return request({
    url: '/loanProduct/queryByParam',
    params,
    method: 'get'
  })
}
export const updateProduct = (data) => {
  return request({
    url: '/loanProduct',
    data,
    method: 'put'
  })
}
export const addProduct = (data) => {
  return request({
    url: '/loanProduct/add',
    data,
    method: 'post'
  })
}
export const deleteProduct = (id) => {
  return request({
    url: `/loanProduct/delete/${id}`,
    method: 'get'
  })
}
export const loanProductPreview = (id) => {
  return request({
    url: `/loanProduct/preview/${id}`,
    method: 'get'
  })
}
// 实时更新
export const realtime = (id) => {
  return request({
    url: '/loanProduct/realtime/update',
    method: 'put'
  })
}
// 结清规则
export const settleRule = () => {
  return request({
    url: '/loanProduct/settlerule',
    method: 'get'
  })
}
export const updateSettleRule = (data) => {
  return request({
    url: '/loanProduct/settlerule',
    data,
    method: 'put'
  })
}
// 用户等级管理
export const getUserLevel = (params) => {
  return request({
    url: '/loanUserLevel/queryByParam',
    params,
    method: 'get'
  })
}
export const updateUserLevel = (data) => {
  return request({
    url: '/loanUserLevel/update',
    data,
    method: 'put'
  })
}
export const addUserLevel = (data) => {
  return request({
    url: '/loanUserLevel/add',
    data,
    method: 'post'
  })
}
export const deleteUserLevel = (id) => {
  return request({
    url: `/loanUserLevel/delete/${id}`,
    method: 'get'
  })
}
// 实时更新
export const realtimeUserLevel = (id) => {
  return request({
    url: '/loanUserLevel/realtimeupdate',
    method: 'put'
  })
}
// 适用的贷款产品
export const getLoanProduct = () => {
  return request({
    url: '/loanProduct/productUserType',
    method: 'get'
  })
}
// 日历
export const getCalendar = (params) => {
  return request({
    url: '/work/calendar/get',
    params,
    method: 'get'
  })
}
export const changeWorkDay = (data) => {
  return request({
    url: '/work/calendar/state',
    data,
    method: 'put'
  })
}
// 帮助中心
export const getHelpCenter = (params) => {
  return request({
    url: '/messageCenter/helpCenter/helps',
    params,
    method: 'get'
  })
}
export const getMaxOrderAddOne = () => {
  return request({
    url: '/messageCenter/helpCenter/maxOrder',
    method: 'get'
  })
}
export const addHelpCenter = (data) => {
  return request({
    url: '/messageCenter/helpCenter/help',
    data,
    method: 'post'
  })
}
export const updateHelpCenter = (data) => {
  return request({
    url: '/messageCenter/helpCenter/help',
    data,
    method: 'put'
  })
}
export const deleteHelpCenter = (id) => {
  return request({
    url: `/messageCenter/helpCenter/help/${id}`,
    method: 'delete'
  })
}
export const moveUpHelpCenter = (id) => {
  return request({
    url: `/messageCenter/helpCenter/help/shiftUp/${id}`,
    method: 'patch'
  })
}
export const moveDownHelpCenter = (id) => {
  return request({
    url: `/messageCenter/helpCenter/help/shiftDown/${id}`,
    method: 'patch'
  })
}
// 短信模板
export const getSMS = (params) => {
  return request({
    url: '/msg/query',
    params,
    method: 'get'
  })
}
export const updateSMS = (data) => {
  return request({
    url: '/msg/update',
    data,
    method: 'put'
  })
}
// push推送模板
export const getPushTemplate = (params) => {
  return request({
    url: '/appMsgPush/query',
    params,
    method: 'get'
  })
}
export const updatePushTemplate = (data) => {
  return request({
    url: '/appMsgPush/update',
    data,
    method: 'put'
  })
}
// 联系方式
export const getContactInfo = (params) => {
  return request({
    url: '/contactInfo',
    params,
    method: 'get'
  })
}
export const updateContactInfo = (data) => {
  return request({
    url: '/contactInfo/update',
    data,
    method: 'put'
  })
}
// 银行管理
export const getBank = (params) => {
  return request({
    url: '/bankManage',
    params,
    method: 'get'
  })
}
export const getMaxSortAddOne = () => {
  return request({
    url: '/bankManage/getMaxSort',
    method: 'get'
  })
}
export const addBank = (data) => {
  return request({
    url: '/bankManage/create',
    data,
    method: 'post'
  })
}
export const updateBank = (data) => {
  return request({
    url: '/bankManage/update',
    data,
    method: 'post'
  })
}
export const deleteBank = (id) => {
  return request({
    url: `/bankManage/${id}`,
    method: 'delete'
  })
}
export const moveUpInBank = (id) => {
  return request({
    url: `/bankManage/shiftUp/${id}`,
    method: 'patch'
  })
}
export const moveDownInBank = (id) => {
  return request({
    url: `/bankManage/shiftDown/${id}`,
    method: 'patch'
  })
}
// 版本更新
export const getVersion = (params) => {
  return request({
    url: '/version',
    params,
    method: 'get'
  })
}
export const addVersion = (data) => {
  return request({
    url: '/version/create',
    data,
    method: 'post'
  })
}
export const deleteVersion = (id) => {
  return request({
    url: `/version/${id}`,
    method: 'delete'
  })
}
